home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / ste / sam_seq.lzh / SAM_SEQ / BASICS / STOS / STOSTEST.BAS (.txt) < prev   
Atari STOS Basic  |  1993-01-04  |  9KB  |  210 lines

  1. 10 REM                 Simple Sequence Demo for STOS Basic
  2. 100 REM 
  3. 1000 REM  will have NO effect since they are only used to initialise. You MUST
  4. 1010 REM  STOP the current sequence, re-poke the values, then call Go again.
  5. 1020 REM 
  6. 1030 REM                      Now REPLAY the sequence Once
  7. 1040 REM 
  8. 1050 LOKE
  9. 1060 VARNAME
  10. 1070 VARNAME
  11. 1080 CALL
  12. 1090 REM 
  13. 110 RESERVE
  14. 1100 REM  4 commands start the sequence (ALL MODE, not using sep. mix)
  15. 1110 REM  The commands below wait for it to stop.
  16. 1120 REM  and check for a key press
  17. 1130 REM 
  18. 1140 PRINT
  19. 1150 WAIT
  20. 1160 WHILE
  21. 1170 PRINT
  22. 1180 VARNAME
  23. 1190 IF
  24. 120 RESERVE
  25. 1200 WEND
  26. 1210 WAIT
  27. 1220 REM 
  28. 1230 REM                     Now PLAY the other mix 5 Times
  29. 1240 REM  It IS IMPORTANT that the previous sequence was Halted before the next
  30. 1250 REM  sequence begins !!!!!
  31. 1260 REM 
  32. 1270 LOKE
  33. 1280 VARNAME
  34. 1290 VARNAME
  35. 130 REM 
  36. 1300 CALL
  37. 1310 REM 
  38. 1320 REM  Anothermix is sent the address of the mix 
  39. 1330 REM  And C_down is set to loop 5 times
  40. 1340 REM 
  41. 1350 PRINT
  42. 1360 PRINT
  43. 1370 PRINT
  44. 1380 WAIT
  45. 1390 WHILE
  46. 140 REM  In order to save using more banks for the separate mixes
  47. 1400 PRINT
  48. 1410 VARNAME
  49. 1420 IF
  50. 1430 WEND
  51. 1440 REM 
  52. 1450 REM                Now REPLAY the sequence (normal) - Infinite Loops
  53. 1460 REM 
  54. 1470 LOKE
  55. 1480 VARNAME
  56. 1490 VARNAME
  57. 150 REM  It is easier to just use an array. Dimension the array to the
  58. 1500 CALL
  59. 1510 REM 
  60. 1520 REM  C_down=0 ; This sets looping to infinite ! 
  61. 1530 REM  loke => Go back to using the (ALL of) Sequence mix
  62. 1540 REM  wait for a key to stop 
  63. 1550 REM 
  64. 1560 PRINT
  65. 1570 WAIT
  66. 1580 VARNAME
  67. 1590 WHILE
  68. 160 REM  Desktop size in bytes of the mix file.
  69. 1600 VARNAME
  70. 1610 WEND
  71. 1620 CALL
  72. 1625 VARNAME
  73. 1630 REM 
  74. 1640 REM  First Loke ANOTHERMIX with the address of your mix, or zero if you
  75. 1650 REM  want to play the mix in your sequence file.
  76. 1660 REM  Then set FINISH to a positive value other than zero. Usually 1.
  77. 1670 REM  Set the C_DOWN (count down) variable to the number of plays required
  78. 1680 REM  Or to zero for infinite looping.
  79. 1690 REM Call the GO routine.The sequence is now happily running under interupt
  80. 170 REM 
  81. 1700 REM  (all on its own). If you want to just let it run then put the rest of
  82. 1710 REM  your program after the call. Your program will run while the sequence
  83. 1720 REM is running.If you wish to stop the sequence at any time just call HALT
  84. 1730 REM  This will disable the interupt and stop the seq.
  85. 1732 REM  You should also set FINISH to zero - although this isn't necessary
  86. 1733 REM  it may be of use to you, having a flag which is zero when no seq.
  87. 1734 REM  is playing. NOTE FINISH is automatically set to zero when all loops
  88. 1735 REM  have been played !!! and it holds the sequencial number of the next
  89. 1736 REM  sample it was to play if you stop the seq. with HALT.
  90. 1740 REM  If you want to know when the seq. is finished then check the value of
  91. 1750 REM  FINISH if it is zero the seq. is finished (all loops have been done).
  92. 1760 REM  FINISH is set to one every time the first sample is being played.
  93. 1770 REM  A Final Note :
  94. 1780 REM  DO NOT CHANGE OR REMOVE EITHER THE SEQUENCE OR THE CODE WHILE A SEQ.
  95. 1790 REM  IS PLAYING. THIS WILL CRASH THE ATARI. YOU MUST CALL Halt BEFORE DOING
  96. 180 DIM
  97. 1800 REM  THIS. ALSO DO NOT START ANOTHER SEQUENCE WHILE A SEQUENCE IS PLAYING
  98. 1810 REM  THIS WILL CREATE TWO INTERUPTS, THE FIRST OF WHICH CAN NOT BE REMOVED
  99. 1820 REM  BY Halt AND PROBABLY CRASH THE MACHINE.
  100. 1830 REM  YOU MUST ALSO NOT TERMINATE YOUR PROGRAM WHILE A SEQUENCE IS
  101. 1840 REM  PLAYING, UNLESS YOU MAKE THE CODE AND SEQ. STAY RESIDENT. SO BEFORE 
  102. 1850 REM TERMINATING YOUR PROGRAM CHECK THAT A SEQUENCE IS NOT PLAYING, OR JUST
  103. 1860 REM  CALL Halt TO BE SAFE.
  104. 1870 REM 
  105. 1880 REM  ONE FINAL IMPORTANT WARNING - IF YOUR PROGRAM STOPS, BECAUSE OF
  106. 1890 REM  A SYNTAX ERROR (OR ANY ERROR) OR IF YOU BREAK INTO IT BEFORE
  107. 190 REM 
  108. 1900 REM  IT TERMINATES ITSELF (WHEN IN THE EDITOR) CALL Halt JUST TO BE SURE.
  109. 1910 REM  BECAUSE THE SEQUENCE WILL KEEP PLAYING WHILE YOU EDIT THE PROGRAM
  110. 1920 REM  AND IF YOU TRY TO RUN YOUR PROGRAM AGAIN (OR THE ARRAYS/BANKS GET
  111. 1930 REM  ALTERED IN ANY WAY) THE MACHINE WILL EVENTUALLY CRASH !!!
  112. 1940 REM  -- IT'S PROBABLY BEST IF YOU PUT THE MUSIC IN AFTER YOU'VE
  113. 1950 REM  WRITTEN AND TESTED YOUR PROGRAM SINCE SWITCHING OF THE INTERRUPT
  114. 1960 REM  EVERYTIME YOU BREAK INTO YOUR PROGRAM CAN BE A REAL BIND --
  115. 1970 REM  HAVE FUN - THATS ALL FOLKS !
  116. 1980 REM 
  117. 1990 PRINT
  118. 20 REM                    by I.Hancock- PHAZE Shift Inc.
  119. 200 REM                             Load machine code
  120. 2000 PRINT
  121. 2010 ERASE
  122. 2020 END
  123. 210 REM 
  124. 220 PRINT
  125. 230 LOAD
  126. 240 REM 
  127. 250 REM  Assign variables to point to the start addresses of the banks/arrays
  128. 260 REM 
  129. 270 VARNAME
  130. 280 VARNAME
  131. 290 VARNAME
  132. 30 REM 
  133. 300 VARNAME
  134. 310 VARNAME
  135. 320 REM 
  136. 330 REM  Code and Sequence and Mix are the relevent start addresses.
  137. 340 REM  Finish is a variable passed to the machine code routine. It is
  138. 350 REM  incremented every time a sample is played from the sequence or mix and
  139. 360 REM  set to zero when the sequence or mix finish (after all loops).
  140. 370 REM  C_down is another passed variable. It counts down each loop.
  141. 380 REM 
  142. 390 REM                            Define CALL addresses
  143. 40 REM  Reserve banks for code & sequence (& if wanted alternate mixes)
  144. 400 REM 
  145. 410 VARNAME
  146. 420 VARNAME
  147. 430 REM 
  148. 440 REM  Go and Halt are the start addresses of the machine code routines.
  149. 445 REM  Note: DO NOT call HALT before calling PLAY at least ONCE !!!
  150. 450 REM 
  151. 460 REM                            Define storage offsets
  152. 470 REM 
  153. 480 VARNAME
  154. 490 VARNAME
  155. 50 REM  & allocate addresses for each. Bk 9 should be dimensiond to the desktop
  156. 500 VARNAME
  157. 510 VARNAME
  158. 520 REM 
  159. 530 REM  Seqstart is the address to which you must write the start address of
  160. 540 REM  the sequence. You MUST always have a sequence even if you only use the
  161. 550 REM  mixes. Since the .SEQ file contains the samples to be used by the mix.
  162. 560 REM .MIX files only contain the order of play information, this is why they
  163. 570 REM are alot smaller. Using a MIX file which is not correct for the current
  164. 580 REM sequence may CRASH the computer. To be sure a MIX file will work with a
  165. 590 REM  sequence:- load the sequence into my sequencing program, then load
  166. 60 REM  size in bytes of your sequence file. You can have as many alternative
  167. 600 REM  the MIX file. If the MIX file loads then it IS OK.
  168. 610 REM  Fin is the address to which you must write the address of your Finish
  169. 620 REM flag.: Ever is the address to which your must write the address of your
  170. 630 REM  C_down variable.(count down) mode.
  171. 640 REM  Anothermix is the address to which must write the start address of
  172. 650 REM  a separate mix.
  173. 660 REM 
  174. 670 REM                    Load sequence and mix into memory
  175. 680 REM 
  176. 690 PRINT
  177. 70 REM  mixes as you like and should dimension each array to DT size in bytes.
  178. 700 BLOAD
  179. 710 PRINT
  180. 720 BLOAD
  181. 730 REM 
  182. 740 REM                         Poke Sequence data into code
  183. 750 REM 
  184. 760 LOKE
  185. 770 LOKE
  186. 780 LOKE
  187. 790 LOKE
  188. 80 REM  Bank 8 is the Machine Code to play the sequence and MUST be included.
  189. 800 REM 
  190. 810 REM  The 1st Loke puts the start address of the sequence into the Machine -
  191. 820 REM  -code.The second puts the address of your Finish flag variable into MC
  192. 830 REM  The MC will count Finish up each time it plays another sample from the
  193. 840 REM  sequence/mix. It is finally set to zero when the seq/mix has finished.
  194. 850 REM It is set to 1 at the start of each loop and NEVER goes to zero when in
  195. 860 REM  infinite loop mode.(for obvious reasons - it never finishes!
  196. 870 REM  The third Loke puts the address of your C_down (count down) variable
  197. 880 REM  into the MC. The MC will count C_down down to zero - when the looping
  198. 890 REM  will stop. You can change the value of either of the prev. 2 variables
  199. 90 REM  These banks/arrays are where you will load the files into memory.
  200. 900 REM  HOWEVER if Finish counts above $FFFFFFFF it will reset to zero which
  201. 910 REM  your program may see as sequence finished ! NOTE: setting Finish to 0
  202. 920 REM  will NOT s